package org.fast.project.app.config;

import com.querydsl.jpa.impl.JPAQueryFactory;

import jakarta.persistence.EntityManager;

import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

/**
 * @program: spring-web-archetype-default
 * @description: JPA + QueryDSL 配置支持
 * @author: lilith·bristol
 * @create: 2019-05-03 01:16
 *
 *  EnableJpaAuditing 开启JPA审计功能
 **/
@EnableJpaRepositories(basePackages = {"org.fast.project.dao"})
@EnableJpaAuditing
@EntityScan(basePackages = {"org.fast.project.dao.po"})
@Configuration
public class JpaAndQueryDslConfig {

    @Bean
    public JPAQueryFactory jpaQueryFactory(EntityManager entityManager) {
        return new JPAQueryFactory(entityManager);
    }
}
